﻿namespace Core
{
    public class FrameFeature : Feature
    {
        public override void OnInit()
        {

#if ENABLE_WECHAT && !UNITY_EDITOR
            AddHelper<WechatAssetHelper>();
#else
            AddHelper<AssetHelper>();
#endif

#if ENABLE_HCLR
            AddHelper<HclrHelper>();
#endif

            AddSystem<LogSystem>();
            AddSystem<DebugCoreTipSystem>();

            AddSystem<TimeClockSystem>();
            AddSystem<MonoSystem>();
            AddSystem<ConfigSystem>();
            AddSystem<CameraSystem>();
            AddSystem<TimeSystem>();

            AddHelper<PanelCoverHelper>();
            AddSystem<PanelSystem>();

            AddHelper<AssetCounterHelper>();

            AddSystem<AssetPackerSystem>();

            SelectSystem();
        }

        private void SelectSystem()
        {
#if UNITY_EDITOR
            if (new GetCoreData().Publish().coreData.isUseAssetBundle)
            {
                AddRuntimeSystem();
            }
            else
            {
                AddEditorSystem();
            }
#else
            AddRuntimeSystem();
#endif
        }

#if UNITY_EDITOR
        private void AddEditorSystem()
        {
            AddSystem<AssetSystemEditor>();
            AddSystem<SceneSystemEditor>();
        }
#endif

        private void AddRuntimeSystem()
        {
            AddSystem<AssetSystem>();
            AddSystem<SceneSystem>();
        }
    }
}